// Copyright (c) 2023, yuxinyong and contributors
// For license information, please see license.txt
/* eslint-disable */

frappe.query_reports["Multi Level BOM"] = {
	"filters": [
		{
			fieldname: "bom",
			label: __("BOM"),
			fieldtype: "Link",
			options: "BOM",
			reqd: 1
		},
		{
			fieldname: "limit_to_level",
			label: __("Limit To Level"),
			fieldtype: "Select",
			options:"\n1\n2\n3\n4\n5\n6\n7\n8\n9",
			description: "0 means show all levels",
			default: 0
		},
	],
	"formatter": function(value, row, column, data, default_formatter) {
		value = default_formatter(value, row, column, data);
		//强制以数字编号的物料号字段左对齐输出
		if (data && in_list(['parent_item_code', 'item_code'], column.fieldname)) {						
			//value = $(`<span>${value}</span>`);
			var $value = $(value).addClass("level-left");
			value = $value.wrap("<div></div>").parent().html();			
		}
		return value;
	}
};
